<template>
  <div class="home-simple">
    <h1>首页 - 简化版</h1>
    <p>这是一个简化版的首页，用于测试页面是否能正常显示。</p>
    <p>当前时间: {{ currentTime }}</p>
    
    <div class="test-actions">
      <button @click="navigateToWords">跳转到单词列表</button>
      <button @click="navigateToWordSet">跳转到单词集</button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Home',
  data() {
    return {
      currentTime: new Date().toLocaleString()
    }
  },
  mounted() {
    console.log('简化版首页已加载')
    
    // 每秒更新时间
    this.timer = setInterval(() => {
      this.currentTime = new Date().toLocaleString()
    }, 1000)
    
    // 检查$http和$uni实例是否可用
    console.log('$http实例:', this.$http)
    console.log('$uni实例:', this.$uni)
  },
  beforeUnmount() {
    // 清除定时器
    if (this.timer) {
      clearInterval(this.timer)
    }
  },
  methods: {
    navigateToWords() {
      try {
        console.log('尝试跳转到单词列表')
        this.$router.push('/words')
      } catch (error) {
        console.error('导航失败:', error)
      }
    },
    navigateToWordSet() {
      try {
        console.log('尝试跳转到单词集')
        this.$router.push('/wordset')
      } catch (error) {
        console.error('导航失败:', error)
      }
    }
  }
}
</script>

<style scoped>
.home-simple {
  padding: 40px;
  text-align: center;
}

h1 {
  color: #07c160;
  margin-bottom: 20px;
  font-size: 32px;
}

p {
  color: #333;
  margin-bottom: 15px;
  font-size: 16px;
}

.test-actions {
  margin-top: 30px;
}

button {
  background-color: #07c160;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  margin: 0 10px;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #06ad56;
}
</style>